#include <stdio.h>
#include <stdlib.h>

int* twoSum(int* nums, int numsSize, int target, int* returnSize) 
{
    for(int i = 0; i < numsSize; i++)
    {
        for(int j = i+1; j < numsSize; j++)
        {
            if(target == (nums[i] + nums[j]))
            {
                int *ret =(int *)malloc(sizeof(int) *2);
                ret[0] = i,ret[1] = j;
                *returnSize = 2;
                return ret;
            }
        }
    }
    *returnSize = 0;
    return NULL;
    
}

int main()
{
    int a[] = {9,1,2,5,8,6};
    int target = 10;
    int p;
    int *b = twoSum(a,sizeof(a)/4,target,&p);
    
    for(int i = 0; i < sizeof(b)/4; i++)
    printf("%d ",b[i]);
    printf("\n");
}